<extend name="layout/edit" />

<block name="HEADER">

</block>

<block name="CONTENT">
    <control:form id="form"/>
</block>

<block name="FOOTER">
   <script type="text/javascript">
    var  page=(function(ns){
    	
		ns.init = function(){
			
		}
		
		//选择店铺
        ns.selectUser = function(){
            var filter = {
                url:"modules/common/selectUserVip",
                mode:1,
                type:2,
            }
            $.openIframe(filter,"选择会员",['600px', '480px']);
        }

        ns.selectUserVipCallback = function(ids,data){
        	if(data.length > 1){
        		$.toast(0,'只能单选！');
        		return false;
        	}
        	form.setValue("uid",data[0]['id']);
        	form.setValue("name",data[0]['name']);
        	form.setValue("phone",data[0]['phone']);
        	form.setValue("nickname",data[0]['nickname']);
        	form.setValue("shop_name",data[0]['shop_name']);
        }
	
    
        //保存
        ns.save=function(){
        	var param =  form.getData();
        	if(!param) return false;
        	$.confirm('将会直接到账，确定充值？',function(){
        		$.ajaxs('/admin/v1/user/recharge',param).then(function(res){
	        		form.opener.$.toast(1,'充值成功！');
	        		form.opener.grid.load();
	        		$.close();
	        	});
        	});
        }
        
        return ns;
    }({}));
    
    $(function(){ page.init(); });
   </script>
</block>



